package com.westos.userauth.dao.impl;

import com.westos.userauth.dao.PartyRelationshipDao;
import com.westos.userauth.dao.mybatis.PartyRelationshipDAO;
import com.westos.userauth.domain.PartyRelationship;
import com.westos.userauth.dto.PartyRelationshipDTO;
import com.westos.userauth.dto.RoleDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * 卢梓浩
 */
@Service
public class MybatisPartyRelationshipDao implements PartyRelationshipDao {

    //引入mybatis实现
    @Autowired
    private PartyRelationshipDAO partyRelationshipDAO;

    @Override
    public int insertPartyRelationship(PartyRelationship partyRelationship, String relationshipName) {
        return partyRelationshipDAO.insertPartyRelationship(partyRelationship,relationshipName);

    }

    @Override
    public int updatePartyRelationship(PartyRelationship partyRelationship) {
        return partyRelationshipDAO.updatePartyRelationship(partyRelationship);

    }

    @Override
    public int deletePartyRelationship(Date fromDate) {
        return partyRelationshipDAO.deletePartyRelationship(fromDate);
    }

    @Override
    public int insertPartyRelationshipAndRole(String roleTypeId, String relationshipName, Date fromDate) {
        return partyRelationshipDAO.insertPartyRelationshipAndRole(roleTypeId,relationshipName,fromDate);
    }

    @Override
    public int insertPartyRelationshipType(String partyRelationshipTypeId) {
        return partyRelationshipDAO.insertPartyRelationshipType(partyRelationshipTypeId);

    }

    @Override
    public int insertUpdatePartyRelationshipAndRoles(String roleTypeId, String relationshipName, Date fromDate) {
        return partyRelationshipDAO.insertUpdatePartyRelationshipAndRoles(roleTypeId,relationshipName,fromDate);
    }

    @Override
    public int UpdatePartyRelationshipAndRoles(Date thurDate) {
        return partyRelationshipDAO.UpdatePartyRelationshipAndRoles(thurDate);
    }

    @Override
    public PartyRelationship queryById(String partyIdFrom) {
        return partyRelationshipDAO.queryById(partyIdFrom);
    }
}
